package com.yangfan.cloudalibaba.controller;


import com.yangfan.cloudalibaba.service.AccountService;
import com.yangfan.springcloud.entities.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@Slf4j
public class AccountController {

    @Autowired
    private AccountService accountService;

    @PostMapping(value = "/account/decreaseAccount")
    public CommonResult decreaseAccount(@RequestParam(value = "userId") Long userId,@RequestParam(value = "money") BigDecimal money){
        accountService.decrease(userId,money);
        return new CommonResult(200,"减少库存成功！");
    }


}
